#include "Interpolation.h"
#include <iostream>
using namespace std;

int main(int argc,char *argv [ ]){
    double dis, spe;
    vector<double> Time = {0, 0, 3, 3, 5, 5, 8, 8, 13, 13}, Dis_Spe = {0, 75, 225, 77, 383, 80, 623, 74, 993, 72};
    Hermite_formula hf(Time, Dis_Spe);
    dis = hf.solve(10);
    spe = hf.diff(10);
    cout << "t=10s时汽车的位置为" << dis << "英尺" << endl;
    cout << "t=10s时汽车的速度为" << spe << "英尺/秒" << endl;
    for (int i = 0; i <= 130; i++){
        if (hf.diff(i * 0.1) > 81){
            cout << "汽车超过了每秒81英尺的速度限制" << endl;
            return 0;
        }
    }
    cout << "汽车未超过每秒81英尺的速度限制" << endl;
}
